package com.nbsaas.boot.nbtask.task;

import com.nbsaas.boot.nbtask.domain.OrderMessage;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

@Component
public class OrderConsumer {

    @JmsListener(destination = "order-queue")
    public void processOrder(OrderMessage orderMessage) throws InterruptedException {

        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        //Thread.sleep(5000);
        System.out.println("Processing order: " + orderMessage.getOrderId());
        // 在此处理订单逻辑，例如更新数据库、调用其他服务等
    }
}
